#-*- coding utf-8 -*-

import sqlite3
import csv
'''
conexao = sqlite3.connect('teste.db')
c = conexao.cursor()
c.execute('DROP TABLE IF EXISTS disc')
c.execute('CREATE TABLE disc (nome text, nota number)')
conexao.commint()
notas = [('P1',15),('P2',15),('LP',19)]
c.executemany('INSERT INTO disc VALUES (?,?)', notas)
conexao.commint()
c.execute("SELECT * FROM disc WHERE notas > 16")
print "uma...",c.fetchone()
k=0; soma =0.0
for linha in c.execute("SELECT FROM disc")
    print linha; soma+= linha[1]; k+=1
print "media = {:2.2f}".format(soma/k)
conexao.close()
'''

with open('TesteDisc.csv','rb') as csvfile:
    csvfile.next()
    leitor = csv.reader(csvfile)
    numLinha=0
    soma = 0.0
    for linha in leitor:
            soma+=(int(linha[1]))
            print soma
            numLinha+=1
    print "media:"+str(soma/numLinha)
        
        
            
    
        
